#include<bits/stdc++.h>
#include"game.h"
#define int long long
#define For(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
using namespace std;
bool bk[5005];
bool vis[5005];
vector<int>res;
int gg[5005];
int m;
bool flagg=0;
void dfs(int x){
	if(flagg) return;
	if(x==m+1){
		vector<int>now;
		for(int i=1;i<=m;i++) now.push_back(gg[i]);
		if(count(now)==m) res=now,flagg=1;
		return ;
	}
	for(int i=1;i<=m;i++){
		if(vis[i]) continue;
		gg[x]=i;
		vis[i]=1;
		dfs(x+1);
		gg[x]=0;
		vis[i]=0;
	}
}
std::vector<int> guess(int n, int limit){
	vector<int>ans;
	m=n;
	For(i,1,n){ans.push_back(i);}
	if(n<=9){
		dfs(1);
		return res;
	}
	For(i,1,n){
		if(bk[i]) continue;
		For(j,i+1,n){
			if(bk[j]||i==j)continue;
			For(k,i+1,n){
				if(bk[k]||i==k||j==k)continue;
				swap(ans[j-1],ans[k-1]);
				int x=count(ans);
				swap(ans[i-1],ans[j-1]);
				int y=count(ans);
				if(y==x+2){
					//~ x=y;
					bk[i]=bk[j]=1;
					//~ x=y;
					break;
				}
				if(y==x-2){swap(ans[i-1],ans[j-1]);bk[i]=bk[j]=1;break;}
				swap(ans[i-1],ans[j-1]);
				swap(ans[j-1],ans[k-1]);
			}
			if(bk[i]) break;
		}
	}
	return ans;
}
